package com.itheima.admin.task;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Component;

/**
 * @version 1.0
 * @description 说明
 * @package com.itheima.admin.task
 */
@Component
public class TestTask {

    // 这里设置
    // jobhandler 的名称。任务管理中创建的jobHandler要一致
    @XxlJob("myTestTask")
    public ReturnT<String> doTest(String param){
        System.out.println("param=======>" + param);
        XxlJobLogger.log("任务执行了，参数为:{}",param);
        if("success".equals(param)) {
            return ReturnT.SUCCESS;
        }else{
            return ReturnT.FAIL;
        }
    }
}
